package com.woniuxy.secondkill.configuration;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author zhangyong
 * @Date 2021/8/10 0010下午 2:27
 */
@Configuration
public class RedissonConfiguration {

    @Bean
    public Redisson redisson(){
        //1.创建配置类对象
        Config config = new Config();
        //2.设置工作模式，redis的地址信息
        config.useSingleServer().setAddress("redis://127.0.0.1:6379").setDatabase(0);
        //3.创建redisson对象
        Redisson redisson =(Redisson) Redisson.create(config);
        //
        return redisson;
    }
}
